using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerEvadeState : PlayerGroundedState
{
    public PlayerEvadeState(Player _player, PlayerStateMachine _playerStateMachine, string _animBoolName) : base(_player, _playerStateMachine, _animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();

        player.isEvading = true;

        stateTimer = player.evadeTime;
    }

    public override void Exit()
    {
        base.Exit();

        player.isEvading = false;
    }

    public override void Update()
    {
        base.Update();

        player.SetVelocity(player.facingDir * player.evadeSpeed, rb.velocity.y);

        if (stateTimer < 0)
            player.stateMachine.ChangeState(player.idleState);
    }
}
